Adding Active Server Pages

What are Active Server Pages?
Displaying Date, Time, and Text
Using Counters, Variables, and Forms
Displaying Server Statistics
Active Server Pages Server-Side Scripting Programmer's Reference


Active Server Pages Server-Side Scripting Programmer's Reference

Syntax

An Active Server Pages (ASP) server-side script consists of a statement enclosed by an opening tag ( <% ) and a closing tag ( %> ). Microsoft® Personal Web Server processes the script as follows:
<% if condition then %>
...statements...
[<% else %>
...else-statements...]
<% end if %>

where:

Functions and Procedures

abs (n: number)

Function. Returns the absolute value of n.

chr (asciicharcode: number)

Function. Returns a string containing the ASCII character specified by asciicharcode.

For a list of ASCII characters and character codes, see http://www.microsoft.com/workshop/author/newhtml/htmlr018.htm.

counter.get (thecounter: string)

Function. Returns the current numeric value of thecounter. If thecounter doesn't exist, counter.get creates it and sets it to 0.

counter.increment (thecounter: string)

Function. Adds 1 to the current numeric value of thecounter and returns thecounter's new value. If thecounter doesn't exist, counter.increment creates it and sets it to 1.

date

Function. Returns the current system date as a string.

day (thedate: string)

Function. Extracts the day of the month from thedate and returns it as a number.

hour (thetime: string)

Function. Extracts the hour value from thetime and returns it as a number.

left (thestring: string, n: number)

Function. Returns a string containing the first n characters of thestring.

len (thestring: string)

Function. Returns the number of characters in thestring.

minute (thetime: string)

Function. Extracts the minutes value from thetime and returns it as a number.

month (thedate: string)

Function. Extracts the month value from thedate and returns it as a number.

monthname (themonth: number)

Function. Returns a string containing the name of the month whose number is specified by themonth.

myInfo(fieldname: string)

Function. Each field in the Personal Web Server control panel can be referenced by the function myInfo(fieldname), where fieldname is the corresponding field name in the following list of valid fieldnames:

now

Function. Returns the current system date and time.

Request.ServerVariables ("HTTP_User-Agent")

Function. Returns the client browser type as a string.

Request.ServerVariables("REMOTE_ADDR")

Function. Returns the client's IP (Internet protocol) address as a string.

Request.ServerVariables("REMOTE_HOST")

Function. Returns the client's domain name as a string.

Request.ServerVariables("SERVER_NAME")

Function. Returns the domain name of the server as a string. If the server has no domain name, returns the server's IP address as a string.

Response.AddHeader (headername: string, headervalue: string)

Procedure. Adds a new HTML header with name headername and value headervalue to the response.

Response.charset (charsetname: string)

Procedure. Adds the name of the character set (for example, "ISO-LATIN-7") specified by charsetname to the content-type header in the response. Note: This function inserts any string in the header, whether or not it represents a valid character set.

For more information about commonly used character sets, see http://www.microsoft.com/workshop/author/newhtml/htmlr018.htm.

Response.pics (picslabel: string)

Procedure. Adds the value specified by picslabel to the Pics-label field of the response header.

For more information on ratings, visit http://www.microsoft.com/ie/ie3/ratings.htm.

Response.redirect(anotherURL: string)

Procedure. Redirects the current request to one specified by anotherURL.

right (thestring: string, n: number)

Function. Returns a string containing the last n characters of thestring.

second (thetime: string)

Function. Extracts the seconds value from thetime and returns it as a number.

Server.URLEncode (thestring: string)

Function. Converts thestring from a string to a URL by "escaping" certain characters. For example, each space character is replaced with %20. Returns the URL.

status.fieldname

Function. The status server object stores Personal Web Server status information in its attributes. Each of these attributes can be referenced by the function status.fieldname, where fieldname is one of the valid field names listed below.
Field NameDescription
serverVersionThe version of Microsoft Personal Web Server
startTimeThe time the server started up
startDateThe date the server started up
freememThe amount of free memory the server has
freelowmemThe lowest value for free memory since the server started up
requeststodayThe number of requests (also called "hits") today. Each time someone views a page on your Web site, that counts as a request.
visitorstodayThe number of (unique) visitors to the site today. This number will be lower than the number of requests. This is because each visitor makes at least one request, and if someone visits your Web site more than once in a day, only the first visit is counted in visitorstoday.
requestssincestartThe number of requests since the server started up
visitorssincestartThe number of visitors since the server started up
activehttpsessionsThe current number of HTTP connections
highhttpsessionsThe highest number of concurrent HTTP connections since the server started
busyconnectionsThe total number of connection requests that could not be processed because the server was busy
refusedconnectionsThe total number of requests that were refused because the authentication was invalid
timedoutconnectionsThe total number of connections closed without a request having been received
ktransferedThe total number of kilobytes transferred since the server started up
currentthreadsThe current number of threads
availablethreadsThe current number of available threads
recentvisitorsAn HTML list of recent visitors by domain name or IP address.
popularpagesAn HTML list of most-visited pages

time

Function. Returns the current system time as a string.

timevalue (thetime: string)

Function. Extracts the time value from thetime and returns it as a string.

tools.fileexists (fileurl: string)

Function. Returns -1 if a file exists whose URL is fileurl, 0 otherwise.

tools.owner

Function. Returns -1 if the user is the owner of the Web site. (The owner name and password are set in the Sharing Setup control panel.)

tools.pluginexists (pluginname: string)

Function. Returns -1 if the plug-in whose name is specified by pluginname exists, 0 if it doesn't exist. (Note: The plug-in's name is not necessarily the same as the name of the file that contains the plug-in.)

tools.processform (string1: string, string2: string, [string3: string])

Procedure. Processes the contents of a form that's been filled out by a visitor to the Web site.

tools.random

Function. Returns a random number from -32768 to +32767.

weekday (thedate: string)

Function. Extracts the weekday value from thedate and returns it as a number.

weekdayname (weekday: number)

Function. Returns a string containing the name of the weekday whose number is specified by weekday.

year (thedate: string)

Function. Extracts the year value from thedate and returns it as a number.

Operators

The following operators are supported in ASP server-side scripts:

Return to top